﻿Imports System.Data.SqlClient
Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Session("username") = "Guest" Then
            Label3.Visible = False
        Else
            Label3.Visible = True
        End If

        Label2.Text = Session("username")

        If (Session("username").ToString.ToLower = "admin") Then
            Response.Redirect("welcome admin.aspx")
        End If

        If Session("username") <> "Guest" Then
            Try
                Dim cn As New SqlConnection(ConfigurationSettings.AppSettings("conn"))
                Dim cmd As New SqlCommand("select logindate from users where username='" + Session("username") + "'", cn)
                cn.Open()
                'first row column
                Dim str As String = cmd.ExecuteScalar
                Label3.Text = "Last successful login at : " + str
                cn.Close()
            Catch
            End Try
        End If

    End Sub

    Protected Sub Repeater1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles Repeater1.ItemCommand

    End Sub
End Class
